home *** CD-ROM | disk | FTP | other *** search
/ Chip 2007 January, February, March & April / Chip-Cover-CD-2007-02.iso / Pakiet bezpieczenstwa / mini Pentoo LiveCD 2006.1 / mpentoo-2006.1.iso / livecd.squashfs / usr / lib / mozilla-firefox / idl / nsICachingChannel.idl < prev    next >
Text File  |  2006-05-08  |  7KB  |  151 lines

  1. /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
  2. /* ***** BEGIN LICENSE BLOCK *****
  3.  * Version: MPL 1.1/GPL 2.0/LGPL 2.1
  4.  *
  5.  * The contents of this file are subject to the Mozilla Public License Version
  6.  * 1.1 (the "License"); you may not use this file except in compliance with
  7.  * the License. You may obtain a copy of the License at
  8.  * http://www.mozilla.org/MPL/
  9.  *
  10.  * Software distributed under the License is distributed on an "AS IS" basis,
  11.  * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
  12.  * for the specific language governing rights and limitations under the
  13.  * License.
  14.  *
  15.  * The Original Code is mozilla.org code.
  16.  *
  17.  * The Initial Developer of the Original Code is
  18.  * Netscape Communications Corporation.
  19.  * Portions created by the Initial Developer are Copyright (C) 2001
  20.  * the Initial Developer. All Rights Reserved.
  21.  *
  22.  * Contributor(s):
  23.  *   Darin Fisher <darin@netscape.com> (original author)
  24.  *
  25.  * Alternatively, the contents of this file may be used under the terms of
  26.  * either the GNU General Public License Version 2 or later (the "GPL"), or
  27.  * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
  28.  * in which case the provisions of the GPL or the LGPL are applicable instead
  29.  * of those above. If you wish to allow use of your version of this file only
  30.  * under the terms of either the GPL or the LGPL, and not to allow others to
  31.  * use your version of this file under the terms of the MPL, indicate your
  32.  * decision by deleting the provisions above and replace them with the notice
  33.  * and other provisions required by the GPL or the LGPL. If you do not delete
  34.  * the provisions above, a recipient may use your version of this file under
  35.  * the terms of any one of the MPL, the GPL or the LGPL.
  36.  *
  37.  * ***** END LICENSE BLOCK ***** */
  38.  
  39. #include "nsISupports.idl"
  40.  
  41. interface nsIFile;
  42.  
  43. /**
  44.  * A channel may optionally implement this interface to allow clients
  45.  * to affect its behavior with respect to how it uses the cache service.
  46.  *
  47.  * This interface provides:
  48.  *   1) Support for "stream as file" semantics (for JAR and plugins).
  49.  *   2) Support for "pinning" cached data in the cache (for printing and save-as).
  50.  *   3) Support for uniquely identifying cached data in cases when the URL
  51.  *      is insufficient (e.g., HTTP form submission).
  52.  */
  53. [scriptable, uuid(b1f95f5e-ee05-4434-9d34-89a935d7feef)]
  54. interface nsICachingChannel : nsISupports
  55. {
  56.     /**
  57.      * Set/get the cache token... uniquely identifies the data in the cache.
  58.      * Holding a reference to this token prevents the cached data from being
  59.      * removed.
  60.      * 
  61.      * A cache token retrieved from a particular instance of nsICachingChannel
  62.      * could be set on another instance of nsICachingChannel provided the
  63.      * underlying implementations are compatible.  The implementation of
  64.      * nsICachingChannel would be expected to only read from the cache entry
  65.      * identified by the cache token and not try to validate it.
  66.      *
  67.      * The cache token can be QI'd to a nsICacheEntryInfo if more detail
  68.      * about the cache entry is needed (e.g., expiration time).
  69.      */
  70.     attribute nsISupports cacheToken;
  71.  
  72.     /**
  73.      * Set/get the cache key... uniquely identifies the data in the cache
  74.      * for this channel.  Holding a reference to this key does NOT prevent
  75.      * the cached data from being removed.
  76.      * 
  77.      * A cache key retrieved from a particular instance of nsICachingChannel
  78.      * could be set on another instance of nsICachingChannel provided the
  79.      * underlying implementations are compatible and provided the new 
  80.      * channel instance was created with the same URI.  The implementation of
  81.      * nsICachingChannel would be expected to use the cache entry identified
  82.      * by the cache token.  Depending on the value of nsIRequest::loadFlags,
  83.      * the cache entry may be validated, overwritten, or simply read.
  84.      *
  85.      * The cache key may be NULL indicating that the URI of the channel is
  86.      * sufficient to locate the same cache entry.  Setting a NULL cache key
  87.      * is likewise valid.
  88.      */
  89.     attribute nsISupports cacheKey;
  90.  
  91.     /**
  92.      * Specifies whether or not the data should be cached to a file.  This
  93.      * may fail if the disk cache is not present.  The value of this attribute
  94.      * is usually only settable during the processing of a channel's
  95.      * OnStartRequest.  The default value of this attribute depends on the
  96.      * particular implementation of nsICachingChannel.
  97.      */
  98.     attribute boolean cacheAsFile;
  99.  
  100.     /**
  101.      * Get the "file" where the cached data can be found.  This is valid for
  102.      * as long as a reference to the cache token is held.  This may return
  103.      * an error if cacheAsFile is false.
  104.      */
  105.     readonly attribute nsIFile cacheFile;
  106.  
  107.     /**
  108.      * TRUE if this channel's data is being loaded from the cache.  This value
  109.      * is undefined before the channel fires its OnStartRequest notification
  110.      * and after the channel fires its OnStopRequest notification.
  111.      */
  112.     boolean isFromCache();
  113.  
  114.     /**************************************************************************
  115.      * Caching channel specific load flags:
  116.      */
  117.  
  118.     /**
  119.      * This load flag causes the local cache to be skipped when fetching a
  120.      * request.  Unlike LOAD_BYPASS_CACHE, it does not force an end-to-end load
  121.      * (i.e., it does not affect proxy caches).
  122.      */
  123.     const unsigned long LOAD_BYPASS_LOCAL_CACHE = 1 << 28;
  124.  
  125.     /**
  126.      * This load flag causes the local cache to be skipped if the request
  127.      * would otherwise block waiting to access the cache.
  128.      */
  129.     const unsigned long LOAD_BYPASS_LOCAL_CACHE_IF_BUSY = 1 << 29;
  130.  
  131.     /**
  132.      * This load flag inhibits fetching from the net if the data in the cache
  133.      * has been evicted.  An error of NS_ERROR_DOCUMENT_NOT_CACHED will be sent
  134.      * to the listener's onStopRequest in this case.
  135.      */
  136.     const unsigned long LOAD_ONLY_FROM_CACHE = 1 << 30;
  137.  
  138.     /**
  139.      * This load flag controls what happens when a document would be loaded
  140.      * from the cache to satisfy a call to AsyncOpen.  If this attribute is
  141.      * set to TRUE, then the document will not be loaded from the cache.  A
  142.      * stream listener can check nsICachingChannel::isFromCache to determine
  143.      * if the AsyncOpen will actually result in data being streamed.
  144.      *
  145.      * If this flag has been set, and the request can be satisfied via the
  146.      * cache, then the OnDataAvailable events will be skipped.  The listener
  147.      * will only see OnStartRequest followed by OnStopRequest.
  148.      */
  149.     const unsigned long LOAD_ONLY_IF_MODIFIED = 1 << 31;
  150. };
  151.